<?php
namespace app\madmin\controller;
use app\madmin\model\SystemLogModel;

/**
 * 首页控制器
 * @author  黄明杰 vx:HMJ125855
 * @version 20190101
 */
class Index extends PublicBase{

    
    # 首页系统方法
    public function index(){
        return $this->fetch('Index/index');
    }

    # 首页信息方法
    public function showPage(){
    	# 获取今天开始时间戳及获取今天结束时间戳
		$BegToday = mktime(0,0,0,date('m'),date('d'),date('Y'));
		$EndToday = mktime(23,59,59,date('m'),date('d'),date('Y'));

    	$SystemLog = new SystemLogModel;

    	$Where = [];
        $Where['log_create'] = ['between', [$BegToday, $EndToday]];
        $Where['log_del'] = 1;

        $Admin = $this->checkLogin();

        if($Admin['AdminID'] != 1){
            $Where['log_member'] = ['NEQ', 1];
        }

        # 统计信息
        $Count = [];
        $Where['log_state'] = 1;
        $Count['yes'] = $SystemLog->mCount($Where);
        $Where['log_state'] = 2;
        $Count['no'] = $SystemLog->mCount($Where);

        # 系统信息
    	$Info = [
    		'think_v'		=> THINK_VERSION,
            'server' 	 	=> $_SERVER['SERVER_SOFTWARE'],
            'onload'     	=> ini_get('upload_max_filesize'),
            'phpversion'	=> phpversion()
        ];

        return $this->fetch('Index/showPage', [
        	'Count'	=> $Count,
			'Info' 	=> $Info
		]);
    }

}
